{% load like %}

{% is_like request.user image as is_like %}
{% get_number_of_like image as number_of_likes %}

<form action="{% if not is_like %}{% url 'likes:add' %}{% else %}{% url 'likes:remove' %}{% endif %}" method="post">
    {% csrf_token %}

    <input type="hidden" name='image_id' value="{{ image.id }}">
    <input type="hidden" name='user_id' value="{{ request.user.id }}">

    <button class="btn btn-sm btn-danger">Like {{ number_of_likes }}</button>
    {% if not is_like %}
        <button type="submit" class="btn btn-sm btn-danger">+</button>
    {% else %}
        <button type="submit" class="btn btn-sm btn-secondary">-</button>
    {% endif %}

</form>
